{if $full_page}
    {include file="pageheader.htm"}
    {insert_scripts files="../js/utils.js,listtable.js"}

<script>
function uploadFile()
{
    var fileName = document.getElementById('contact_file').value;
    if(fileName == '' || fileName == undefined)
    {
        alert('请选择文件');
        return false;
    }
    var typeArr = fileName.split('.');
    var fileType = typeArr[typeArr.length - 1];
    if(fileType != 'csv' && fileType != 'xls' && fileType != 'xlsx')
    {
        alert('选择的文件，文件格式必须为 [ csv, xls, xlsx ]');
        return false;
    }
    
    document.getElementById('file_type').value = fileType;
    theForm.submit();
}

function selectAll(obj) {
    var flag = true;
    if(!obj.checked)
        flag = false;
    
    var checkboxs = document.getElementsByName("checkboxes[]");
    for (var i=0; i<checkboxs.length; i++) {
        checkboxs[i].checked = flag;
    }
}

function delContact(obj)
{
    var contactId = obj.rev;
    if(confirm("确定要删除ID为 ["+contactId+"] 的联系人吗?"))
    {
        var url = obj.rel + '&contactId=' + contactId;
        window.location.href = url;
    }
}

function controlBtnStatus(obj)
{
    var btn = document.getElementById('smsContact');
    
    if(obj.checked)
        btn.disabled = false;
    else
    {
        var checkboxs = document.getElementsByName("checkboxes[]");
        var flag = true;
        for (var i=0; i<checkboxs.length; i++) {
            if(checkboxs[i].checked)
            {
                flag = false;
                break;
            }
        }
        btn.disabled = flag;
    }
}
</script>

<div class="form-div">
    <form method="post" action="contact_list.php" name="theForm" enctype="multipart/form-data">
        <input type="file" id="contact_file" name="contact_file" />
        <input type="hidden" id="file_type" name="file_type" value="" />
        <input type="button" value="{$lang.import_contact}" class="button" onclick="uploadFile()" />
        <input type= "hidden" name="act" value = "upload">
    </form>
</div>

<div class="list-div" id="listDiv">

{/if}

  <table cellpadding="3" cellspacing="1">
    <tr>
        <th><input type="checkbox" id="checkAll" onClick="selectAll(this);" />编号</th>
      <th>买家会员名</th>
      <th>收货人姓名</th>
      <!-- <th>联系电话</th> -->
      <th>联系手机</th>
      <th>订单创建时间</th>
      <th>订单付款时间</th>
      <th>物流单号</th>
      <th></th>
    </tr>
    {foreach from=$contact_list item=contact}
        <tr>
            <td><input type="checkbox" name="checkboxes[]" value="{$contact.Contact_Id}" onclick="controlBtnStatus(this);" />{$contact.Contact_Id}</td>
            <td>{$contact.Buyer_Name}</td>
            <td>{$contact.Consignee}</td>
            <!-- <td>{$contact.Contact_Number}</td> -->
            <td>{$contact.Contact_Phone}</td>
            <td>{$contact.Order_Create_Time}</td>
            <td>{$contact.Order_Pay_Time}</td>
            <td>{$contact.Logistics_Number}</td>
            <td><a href="javascript:;" rel="contact_list.php?act=del" rev="{$contact.Contact_Id}" onclick="delContact(this);" >删除</a></td>
        </tr>
    {foreachelse}
        <tr><td class="no-records" colspan="4">{$lang.no_records}</td></tr>
    {/foreach}
  </table>
  <table id="page-table" cellspacing="0">
  <tr>
    <td align="right" nowrap="true">
    {include file="page.htm"}
    </td>
  </tr>
  </table>

<input type="button" value="发送短信" id="smsContact" name="smsContact" class="button" disabled="true" />

{if $full_page}
</div>

<script type="text/javascript">
  listTable.recordCount = {$record_count};
  listTable.pageCount = {$page_count};

  {foreach from=$filter item=item key=key}
    listTable.filter.{$key} = '{$item}';
  {/foreach}
</script>

{include file="pagefooter.htm"}
{/if}